﻿using System.Web.Mvc;
using KaytechSoftware.Cms.App.Areas.Content.Models;
using KaytechSoftware.Cms.Services.Interfaces;
using KaytechSoftware.Cms.Services.Interfaces.Entity;

namespace KaytechSoftware.Cms.App.Areas.Content.Controllers
{
    public class GenericPageController : Controller
    {
        private readonly IPageService _pageService;

        public GenericPageController(IPageService pageService)
        {
            _pageService = pageService;
        }

        public ActionResult Render(long id)
        {
            var pageDto = _pageService.GetDtoById(id);
            var model = new GenericPageModel();
            model.PageId = pageDto.Id;
            model.Title = pageDto.Title;
            model.LeftSideRenderer = pageDto.LeftSideRendererCode;
            model.RightSideRenderer = pageDto.RightSideRendererCode;
            return View(model);
        }
    }
}
